package com.qmx.launcher.activity;

import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qmx.launcher.R;

/**
 * @author chengxiangtong
 * @date 2018/12/22
 * version : 1.0
 * class describe：*
 */
public class VpFragment extends Fragment {
    private View view;
    private String data;    //数据

    public VpFragment() {    //无参构造人为写出来

    }

    @SuppressLint("ValidFragment")
    public VpFragment(String data) {    //创建一个有参构造传递数据
        this.data = data;
    }


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.item_vp, null);
        //        view = LayoutInflater.from(getActivity()).inflate(R.layout.item_vp, null);
        //初始化
        TextView tv = (TextView) view.findViewById(R.id.tv);
        //数据绑定
        tv.setText(data);

        return view;
    }
}
